import { BaseWindow } from "../../../component/window/BaseWindow";
import { ILockCancelProtectWindow } from "../../../../modules/interfaces/ILockCancelProtectWindow";
import { Language } from "../../../../extend/language/Language";
import { ObjCreate } from "../common/ObjCreate";
import { ConfirmProtectInfoSprite } from "./ConfirmProtectInfoSprite";
import { LockInfoData } from "./LockInfoData";
import { GButton } from "../../../../com/mui/controls/GButton";
type int = number;
//class LockCancelProtectWindow
    
    export  class LockCancelProtectWindow extends BaseWindow implements ILockCancelProtectWindow
    {
        constructor()
        {
            super();
            setSize(360, 440);
            title = Language.getString(35500);
            titleHeight = 30;
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            var loc1=ObjCreate.createBg(17, 42, 325, 390, this);
            this._confirmProtect = new ConfirmProtectInfoSprite();
            this._confirmProtect.x = 30;
            this._confirmProtect.y = 55;
            addChild(this._confirmProtect);
            this._sureBtn = ObjCreate.createGButton(Language.getString(35227), 90, 400, 70, 25, this);
            this._sureBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onSureBtnHandler);
            this._cancelBtn = ObjCreate.createGButton(Language.getString(35407), 200, 400, 70, 25, this);
            this._cancelBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onCancelBtnHandler);
            this._leftTimes = ObjCreate.createTextField("", 110, 370, 300, 20, this);
            this._leftTimes.htmlText = "<font color=\'#ff0000\'></font>";
            this._leftTimes.filters = [];
            return;
        }

        /* internal  */onSureBtnHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            this._confirmProtect.clearLock();
            return;
        }

        /* internal  */onCancelBtnHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            this.hide();
            return;
        }

        public setQuestion(): void
        {
            this._confirmProtect.setQuestion();
            this._isSetQ = true;
            return;
        }

        public /* override */ show(arg1: int=0, arg2: int=0): void
        {
            super.show(arg1, arg2);
            if (!this._isSetQ) 
            {
                this.setQuestion();
            }
            this.setLeftTimes();
            return;
        }

        public /* override */ hide(): void
        {
            super.hide();
            this._confirmProtect.resetSprite();
            return;
        }

        public setLeftTimes(): void
        {
            if (LockInfoData.sPlayerLockError == null) 
            {
                return;
            }
            this._leftTimes.htmlText = Language.getStringByParam(35501, LockInfoData.sPlayerLockError.leftClearTimes);
            return;
        }

        /* internal */ /* var */_confirmProtect: ConfirmProtectInfoSprite;

        /* internal */ /* var */_sureBtn: GButton;

        /* internal */ /* var */_cancelBtn: GButton;

        /* internal */ /* var */_isSetQ: Boolean=false;

        /* internal */ /* var */_leftTimes: Object /* flash.text.TextField */;
    }
